package com.tanhua.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.manager.domain.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

//    查询的是某一天登录人数或者注册人数
    @Select(" select count(DISTINCT user_id) from tb_log  where log_time=#{logTime} and type=#{type}")
    Integer queryNumRegisteredOrLogin(@Param("logTime") String logTime, @Param("type")String type);

//    查询某一天的活跃人数
    @Select("select count(DISTINCT user_id) from tb_log  where log_time=#{logTime}")
    Integer queryNumActive(String logTime);

    @Select(" select  count(DISTINCT user_id ) from tb_log  where log_time=#{logTime} and user_id in ( " +
            " select DISTINCT user_id  from tb_log  where log_time=#{yesToday} and type='0102')")
    Integer queryNumRetention1d(@Param("logTime") String logTime,@Param("yesToday") String yesToday);
}
